/* 
 * 功能：权限按钮，控制按钮显隐
 * 参数：按钮编码
 */
export default {
    inserted: (el, binding, vnode, oldVnode) => {
        let arg = binding.value;    //指令参数
        let component = vnode.child;   //VueComponent实例
        
        if (!permissionJudge(arg)) {
            el.parentNode.removeChild(el);
        }

        function permissionJudge(encode) {
            let permiss = false;
            let authBtns = component.$route.meta.btns;  //当前路由权限按钮
            if (authBtns)
                permiss = authBtns.includes(encode);
            return permiss
        }
    }
}